<%--
 * (c)2010-2013 Andrea Caltroni (andrea.caltroni@pd.infn.it), INFN (www.infn.it)
 *
 * This file is part of the IGI Survey Portlet (from here on shortened to IGISP).
 * IGISP is free software: you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the Free 
 * Software Foundation, either version 3 of the License, or (at your option) any 
 * later version.
 *
 * IGISP is distributed in the hope that it will be useful, but WITHOUT ANY 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with IGISP. If not, see <http://www.gnu.org/licenses/>.
 *
--%>

<%@ include file="./init.jsp" %>

<h3><spring:message code="answer.edit.title"/></h3>

<div class="portlet-body">

    <portlet:actionURL var="actionUrl">
        <portlet:param name="action" value="editAnswer"/>
        <portlet:param name="answerID" value="${answer.id}"/>
    </portlet:actionURL>

    <form:form commandName="answer" method="post" action="${actionUrl}">

        <div><form:errors cssClass="portlet-msg-error" /></div>

        <table class="lfr-table">
            <tr>
                <th><spring:message code="answer.label.question"/>: </th>
                <td>${question.description}</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><spring:message code="answer.label.description"/>*: </th>
                <td><form:textarea path="description" rows="5" cols="40" /></td>
                <td><form:errors cssClass="portlet-msg-error" path="description" /></td>
            </tr>
            <tr>
                <th><spring:message code="answer.label.position"/>*: </th>
                <td><form:select path="position" items="${answerPositions}" title="position"/></td>
                <td><form:errors cssClass="portlet-msg-error" path="position" /></td>
            </tr>
            <tr>
                <th><spring:message code="answer.label.answerMode"/>*: </th>
                <td><form:select path="answerMode" items="${answerModeValues}" title="answerMode"/></td>
                <td><form:errors cssClass="portlet-msg-error" path="answerMode" /></td>
            </tr>
        <c:if test="${(skipToQuestions != null) && (fn:length(skipToQuestions) > 0)}">
            <tr>
                <th><spring:message code="answer.label.skipToQuestion"/>: </th>
                <td>
                <form:select path="skipToQuestion">
                    <form:option value="-1" label="None"/>
                    <form:options items="${skipToQuestions}" itemValue="id" itemLabel="position"/>
                </form:select>
                </td>
                <td><form:errors cssClass="portlet-msg-error" path="skipToQuestion" /></td>
            </tr>
    </c:if>
        </table>

        <div class="lfr-separator">&nbsp;</div>
    
        <div class="lfr-toolbar">
            <button type="submit"><spring:message code="button.save"/></button>
        </div>

    </form:form>
</div>

<div class="lfr-separator">&nbsp;</div>

<div class="portlet-section-footer">
    <a href="<portlet:renderURL portletMode="view"/>"><img title="<spring:message code="button.home"/>" src="<html:imagesPath/>home.png" border=0 /></a>
</div>
